#define _CRT_SECURE_NO_WARNINGS 1


#include<vector>
#include<iostream>

using namespace std;

vector<int> Merge(vector<int>& v1, vector<int>& v2)
{
    vector<int> v;
    int begin1 = 0, end1 = v1.size();
    int begin2 = 0, end2 = v2.size();
    while (begin1 < end1 && begin2 < end2)
    {
        if (v1[begin1] < v2[begin2])
        {
            v.push_back(v1[begin1++]);
        }
        else
        {
            v.push_back(v2[begin2++]);
        }
    }
    while (begin1 < end1)
    {
        v.push_back(v1[begin1++]);
    }
    while (begin2 < end2)
    {
        v.push_back(v2[begin2++]);
    }
    return v;
}

double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2)
{
    vector<int> v = Merge(nums1, nums2);
    int size = v.size();
    int left = 0, right = size - 1;
    int mid = (left + right) / 2;
    if (size % 2 == 0)
    {
        return (v[mid] + v[mid + 1]) / 2.0;
    }
    else
    {
        return (double)v[mid];
    }
}

int main()
{
    vector<int> v1 = { 1,2 };
    vector<int> v2 = { 3,4 };
    printf("%.2lf\n", findMedianSortedArrays(v1, v2));
        
    return 0;
}